package br.com.estevam.sisfin.daos;

import org.apache.tapestry5.hibernate.HibernateSessionManager;
import org.apache.tapestry5.services.ApplicationStateManager;

import br.com.estevam.sisfin.daos.interfaces.EstadoCivilDAO;
import br.com.estevam.sisfin.entities.EstadoCivil;

public class EstadoCivilDAOImpl extends AbstractDAOImpl implements EstadoCivilDAO {

	public EstadoCivilDAOImpl(HibernateSessionManager hsm, ApplicationStateManager asm){
		super(hsm, asm, EstadoCivil.class);
		executarCriarEstadoCivil();
	}
	
	void executarCriarEstadoCivil(){
		if(rowCountAll() == 0){
			add(new EstadoCivil("Solteiro(a)"));
			add(new EstadoCivil("Casado(a)"));
			add(new EstadoCivil("Desquitado(a)"));
			add(new EstadoCivil("Separado(a)"));
			add(new EstadoCivil("Viúvo(a)"));
			
			commit();
		}
	}

}
